package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.*;

import java.util.HashMap;

@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class Department {
    private Long id;

    private String name;

    private String sn;

    //返回 json格式的字符串
    public String getJson(){
        //为了避免传一个department对象造成死循环,现在穿一个map对象
        HashMap<Object, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("sn",sn);
        return JSON.toJSONString(map);
    }
}